home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
tex
/
filecomp.zip
/
FILECOMP.DOC
< prev
Wrap
Text File
|
1987-02-02
|
4KB
|
79 lines
FILECOMP
PROBLEM: We needed a good way of comparing two different text files for
similarities/differences on a line-by-line, character-by-character basis.
DOS comes w/ the COMP command; errors are reported in terms of byte-offsets.
Our keypunchers needed errors reported in terms of columns. Also needed was
variable line-lengths, i.e., only some portion of each line needed to be
created.
SOLUTION: We wrote our own text-comparison program in Turbo Pascal:
FILECOMP.
FEATURES: Error-checking: will not accept the same filename for the two
files to be checked, checks to see if specified files exist
Diagnostics: After checking each from a file to another, should
there be descrepancies, the output would be:
vvvvvvvvvvvvvvvvvvvvvvvvvvvv SAMPLE OUTPUT vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
LINE 1:
this is a line of data from the first file.
....+....1....+....2....+....3..||||||||||||
this is a line of data from the second file.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SAMPLE OUTPUT ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
In the above example, the first line is the line number of the first file.
The second and fourth lines are actual lines from the two files, up to the
specified line-length. The third line is a grid to help gauge the column #'s.
The tenth columns are demarked w/ a corresponding integer, e.g., '5' is the
fiftieth column. The fifth columns are denoted w/ a '+', e.g., a '+' between
the twentieth and thirtieth columns is the 25th column. Any '.'s are just
the other columns. All of the markings are superseded by a '|' if the corresponding
column contains different values for the two files, e.g., in the above output
the first error occurs in column 33. Users of IBM's XEDIT and Mansfield
Software's KEDIT will recognize this grid as the "scale".
At the end of the diagnostic output, the # of total errors, the average
errors per line, and the total line-lengths from both files is reported. A
further warning message is printed if the two files are of unequal length.
Output Device: Three are available, Your printer (the device
attached to the default list device), your screen (the device attached to
the default terminal-output), and a text file, ("output.txt").
USEAGE: controlled via command-line arguments:
filecomp w x y z
where:
w = where output will be printed:
0:printer, 1: output.txt file, default: screen
x = # of columns to read for each line (max = 255).
If any line is shorter than the specified line
length, the comparison is made w/ padded blanks.
y & z = two DOS filenames to be compared. Include
drive & pathname either if not in current directory.
RULES FOR USE OF FILECOMP: FILECOMP is distributed "as-is" and only through
public-domain channels. No one person or organization may re-distribute
FILECOMP as part of a "bundling" deal, i.e., FILECOMP cannot be
re-distributed by any means whereby a user would have to purchase either
another program or would have to purchase the service of providing
FILECOMP. FILECOMP was written strictly for users of the public domain
software, as a way of paying back other software authors from whom I've
benefited. Only the source code for FILECOMP costs ($5). If You are
interested in obtaining the source code, or if any organization or person is
interested in "bundling" FILECOMP, please contact:
R.Rasulis Consulting Services
c/o:
BITNET: SMGGYUC.BOSTONU.WISCVM.BITNET
COMPUSERVE: 76347,1021
GEnie: R.RASULIS
SNAILNET: 1961 Commonwealth Ave., Suite 5
Boston, Mass. 02135